{% extends 'base.html' %}
{% block head %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static',filename='./css/editer_article.css') }}">
{#
<script type="text/javascript" src="../../static/admin/js/jquery-1.12.4.min.js"></script>#}
<script type="text/javascript"
        src="{{ url_for('static',filename='tinymce/js/tinymce/jquery.tinymce.min.js') }}"></script>
<script src="{{ url_for('static',filename='tinymce/js/tinymce/tinymce.min.js') }}"></script>
{% endblock %}
{%block title%}
发布内容
{%endblock%}

{% block body %}
<div class="row">
    <div class="col-2"></div>
    <div class="col-8">
        <form action="{{ url_for('article.editer_article') }}" method="post">
            <div class="input-group">
                {# <label for="title">标题</label>#}
                <input type="text" id="title" name="title" placeholder="标题">
            </div>
            <textarea name="content" id="body" cols="30" rows="10"></textarea>
            <div class="">
                <div>
                    <label for="explain">封面和摘要</label>
                </div>
                <textarea name="explain" id="explain" cols="20" rows="10"></textarea>
            </div>
            <div class="input-group">
                <label for="category">分类</label>
                <select name="category" id="category">
                    {% for category in categories %}
                    <option value="{{ category.id }}">{{ category.name }}</option>
                    {% endfor %}
                </select>
                <input type="text" name="new_category" placeholder="没有分类,在此添加">
                <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                <button class="btn btn-primary">提交</button>
            </div>
            {# <label for="category">分类</label>#}
            {# <input type="text" id="category">#}
        </form>
    </div>
    <div class="col-2"></div>
</div>
{% endblock %}

{% block scripts %}
{{ super() }}
<script>
        $(function () {
            tinymce.init({
                selector: '#body',
                //方向从左到右
                directionality: 'ltr',
                //语言选择中文
                language: 'zh_CN',
                //高度为400
                height: 400,
                width: '100%',
                //按tab不换行
                nonbreaking_force_tab: true,
                {#readonly: 1#}
                toolbar: ['undo redo | styleselect | bold italic | link image|bullist numlist|bdmap',
                    'emoticons|code|codesample|hr|link|toc|indent2em'],
                plugins: 'code,lists,advlist,codesample,emoticons,hr,link,toc,bdmap,indent2em',
                {#skin: 'oxide-dark',#}
                {#图片#}
                {#images_upload_url: '{{url_for('article.upload')}}',#}
                {#images_upload_base_path: '/demo',#}
                {#image_caption: true,#}
            });
        })

</script>
{% endblock %}